package LC;

/**
 * @Classname LC538
 * @Description // https://leetcode-cn.com/problems/convert-bst-to-greater-tree/ 树 一次ac
 * @Date 2021/4/21 16:32
 * @Created by yin
 */
public class LC538 {
    int sum = 0;

    public TreeNode convertBST(TreeNode root) {
        if (root == null) return null;
        convertBST(root.right);
        sum += root.val;
        root.val = sum;
        convertBST(root.left);
        return root;
    }
}
